﻿//using System.Collections.Generic;
//using System.Diagnostics;
//using AzureContrib.WindowsAzure.Diagnostics;
//using AzureContrib.WindowsAzure.Utils;

//namespace AzureContrib.WindowsAzure.Tests.Utils
//{
//  public class LoggingTraceListener : TraceListener
//  {
//    private IList<string> writes;

//    public IEnumerable<TraceMessage> Writes
//    {
//      get
//      {
//        foreach (var write in writes)
//          yield return write;
//      }
//    }

//    private LoggingTraceListener()
//      : base("I am a logging trace listener used for test purposes, my type is {0} and I should be removed after each test run.".F(typeof(LoggingTraceListener).FullName))
//    {
//      // Trace.AutoFlush = true;
//      writes = new List<string>();
//    }

//    public override void Write(string message)
//    {
//      writes.Add(message);
//    }

//    public override void WriteLine(string message)
//    {
//      writes.Add(message);
//    }

//    public static LoggingTraceListener Init()
//    {
//      var loggingTraceListener = new LoggingTraceListener();
//      System.Diagnostics.Trace.Listeners.Add(loggingTraceListener);
//      return loggingTraceListener;
//    }

//    public static void Cleanup(LoggingTraceListener traceListener)
//    {
//      System.Diagnostics.Trace.Listeners.Remove(traceListener);
//    }
//  }
//}